package com.aaa.dao;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * @Author: TT
 * @Date: 2019/3/23 14:47
 * @Version 1.0
 */
public interface T_AppraisalScoreDao {
    //单位列表
    @Select("  <script>SELECT  a.id,a.`name`,a.unituser,a.`password`,a.appstate,a.number,a.email,a.linkman,a.linknum,a.address,a.introduce,a.state,a.SHtime,a.SHuser, "
            + "  b.manage,c.type,d.nature,e.industry,f.grading"
            + "  FROM regist a "
            + "  JOIN manage_unit b on a.manage=b.id"
            + "  JOIN unit_type c on a.type=c.id"
            + "  JOIN unit_nature d on a.nature=d.id"
            + "  JOIN industry e ON a.industry=e.id"
            + "  JOIN grading f on a.grading=f.id"
            + "  <if test=\"name!=null and name!=''\"> and name like concat('%',#{name},'%')</if>  "
            + "  where a.state=1 or a.state=2 limit #{start},#{pageSize}</script>")
    List<Map> list(Map map);
    @Select("<script>select count(id) from regist " +
            " where 1=1 <if test=\"id!=null and id!=0\"> and id =#{id}</if>" +
            " <if test=\"name!=null and name!=''\"> and name like concat('%',#{name},'%')</if> and  state=1 </script>")
    Integer getCount(Map map);
    //评议项目列表
    @Select("select * from appraisal_items where state=1")
    List<Map>   applist();
    //插入总分
    @Update("update regist set appscore=#{appscore},appstate=2 where id=#{id}")
    Integer score(Map map1);
}
